#ifndef REMOTESELECTOR_H
#define REMOTESELECTOR_H

#include <QWidget>
#include <qbluetoothuuid.h>
#include <qbluetoothserviceinfo.h>
#include <qbluetoothservicediscoveryagent.h>
#include <QListWidgetItem>
namespace Ui {
class RemoteSelector;
}

class RemoteSelector : public QWidget
{
    Q_OBJECT

public:
    explicit RemoteSelector(QBluetoothAddress&,QWidget *parent = nullptr);
    ~RemoteSelector();
    QMap<QString, QBluetoothServiceInfo> m_discoveredServices;
    /* 开启发现蓝牙 */
    void startDiscovery(const QBluetoothUuid &uuid);
    /* 停止发现蓝牙 */
    void stopDiscovery();
    /* 蓝牙服务 */
    QBluetoothServiceInfo service() const;
signals:
    /* 找到新服务 */
    void newServiceFound(QListWidgetItem*);
    /* 完成 */
    void finished();
private:
    /* 蓝牙服务代理，用于发现蓝牙服务 */
    QBluetoothServiceDiscoveryAgent *m_discoveryAgent;
    /* 服务信息 */
    QBluetoothServiceInfo m_serviceInfo;
private slots:
    /* 服务发现完成 */
    void serviceDiscovered(const QBluetoothServiceInfo &serviceInfo);
    /* 蓝牙发现完成 */
    void discoveryFinished();
private:

};

#endif // REMOTESELECTOR_H
